/*
 *  Copyright 2003 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */
/* "@(#) DDK 1.10.00.23 07-02-03 (ddk-b12)" */
/*
 *  ======== uarthw_mcbsp.h ========
 */

#ifndef UARTHW_MCBSP_H_
#define UARTHW_MCBSP_H_
 
#include <std.h>

#ifdef _6x_
#include <csl_stdinc.h>         /* for Uint32 */
/* interrupt mask definition */
typedef Uns UARTHW_MCBSP_IntrMask;
#endif
#ifdef _54_
#include <csl_stdinc.h>
/* interrupt mask definition */
typedef struct _UARTHW_MCBSP_IntrMask {
     Uns rxIntrMask;
     Uns txIntrMask;
}UARTHW_MCBSP_IntrMask;
#endif
#ifdef _55_
#include <csl_std.h>
/* interrupt mask definition */
typedef struct _UARTHW_MCBSP_IntrMask {
    Uns rxIerMask[2];
    Uns txIerMask[2];
}UARTHW_MCBSP_IntrMask;
#endif

#define UARTHW_MCBSP_PARITYBITS         0       
#define UARTHW_MCBSP_HSTOPBITS          2       
#define UARTHW_MCBSP_DATABITS           8       
#define UARTHW_MCBSP_STARTBITS          1
#define UARTHW_MCBSP_RxHSTOPBITS        1
#define UARTHW_MCBSP_TxHSTOPBITS        UARTHW_MCBSP_HSTOPBITS
#define UARTHW_MCBSP_TxPKTBITS          (UARTHW_MCBSP_STARTBITS + \
                                        UARTHW_MCBSP_DATABITS + \
                                        UARTHW_MCBSP_PARITYBITS + \
                                        UARTHW_MCBSP_TxHSTOPBITS) 
#define UARTHW_MCBSP_RxPKTBITS          (UARTHW_MCBSP_STARTBITS + \
                                        UARTHW_MCBSP_DATABITS + \
                                        UARTHW_MCBSP_PARITYBITS + \
                                        UARTHW_MCBSP_RxHSTOPBITS)

#define UARTHW_MCBSP_MAXBITS            UARTHW_MCBSP_TxPKTBITS

#define UARTHW_MCBSP_INTR_MASK_DEFAULT 1
#define UARTHW_MCBSP_IER_MASK_DEFAULT UARTHW_MCBSP_INTR_MASK_DEFAULT

typedef struct UARTHW_MCBSP_Params {
    Uns         mcbspId;        /* McBSP port id */
    Uns         dmaRxId;        /* DMA channel id ('C5000 only) */
    Uns         dmaTxId;        /* DMA channel id ('C5000 only) */
    Uint32      mcbspClkIn;     /* McBSP frequency */
    Uint32      baud;           /* baud rate */
    UARTHW_MCBSP_IntrMask intrMask; /* Intr mask, set while executing ISR */
} UARTHW_MCBSP_Params;

extern Int UARTHW_MCBSP_start(MdUns *rxBuf, MdUns *txBuf,
         UARTHW_MCBSP_Params *params);

extern Void UARTHW_MCBSP_dmaRxIsr(Void);
extern Void UARTHW_MCBSP_dmaTxIsr(Void);

#ifdef __cplusplus
}
#endif /* extern "C" */

#endif /* UARTHW_MCBSP_H_ */

